package com.ssyc.gsk_master.adapter;

import android.content.Context;
import android.support.annotation.Nullable;
import android.widget.TextView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.makeramen.roundedimageview.RoundedImageView;
import com.ssyc.gsk_master.R;
import com.ssyc.gsk_master.bean.RedListInfo;

import java.util.List;

/**
 * 红包列表的适配器
 * Created by Administrator on 2018/7/23 0023.
 */

public class RedListRvAdapter extends BaseQuickAdapter<RedListInfo.RedPacketsBean, BaseViewHolder> {

    private Context context;

    public RedListRvAdapter(Context context, int layoutResId, @Nullable List<RedListInfo.RedPacketsBean> data) {
        super(layoutResId, data);
        this.context = context;
    }

    @Override
    protected void convert(BaseViewHolder helper, RedListInfo.RedPacketsBean item) {
        //头像
        RoundedImageView ivHead = helper.getView(R.id.iv_head);
        ivHead.setImageResource(R.drawable.master_red_pacaget);

        //红包内容
        TextView tvContent = helper.getView(R.id.tv_content);
        tvContent.setText(item.getTitle());

        //时间
        TextView tvTime = helper.getView(R.id.tv_time);
        tvTime.setText(item.getCreateDate());

        //红包金额
        TextView tvMoney = helper.getView(R.id.tv_money);
        tvMoney.setText(item.getMoney() + "");
    }
}
